using UnityEngine;

[ExecuteInEditMode]
public class editlevel : MonoBehaviour
{
	public DataController alldata;

	public bool isrunflag;

	public int level;

	private void Update()
	{
		if (isrunflag)
		{
			isrunflag = false;
			alldata = GameObject.Find("DataController").GetComponent<DataController>();
			base.transform.name = "level" + level;
			readinfo();
		}
	}

	public void readinfo()
	{
		alldata.DataLevel[level].jidi1id = -1;
		alldata.DataLevel[level].jidi2id = -1;
		alldata.DataLevel[level].island = -1;
		foreach (Transform item in base.transform)
		{
			switch (item.name)
			{
			case "00_player":
				alldata.DataLevel[level].start_pr.pos = item.position;
				alldata.DataLevel[level].start_pr.rot = item.eulerAngles;
				break;
			case "center":
				alldata.DataLevel[level].center = item.position;
				break;
			case "AI_JD_1":
				alldata.DataLevel[level].jidi2id = 0;
				break;
			case "AI_JD_2":
				alldata.DataLevel[level].jidi2id = 1;
				break;
			case "Fri_JD_1":
				alldata.DataLevel[level].jidi1id = 2;
				break;
			case "Fri_JD_2":
				alldata.DataLevel[level].jidi1id = 3;
				break;
			case "AI_JD_3":
				alldata.DataLevel[level].jidi2id = 4;
				break;
			case "AI_JD_4":
				alldata.DataLevel[level].jidi2id = 5;
				break;
			case "bigisland_single":
				alldata.DataLevel[level].island = 0;
				break;
			case "qundao_single":
				alldata.DataLevel[level].island = 1;
				break;
			case "island_double":
				alldata.DataLevel[level].island = 2;
				break;
			}
		}
		UnityEngine.Debug.Log("edit level:" + level + "  over!");
	}
}
